<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="applicable-device" content="pc">
		<meta name="MobileOptimized" content="width">
		<meta name="HandheldFriendly" content="true">
		<title>登录/注册</title>
		<link rel="shortcut icon" href="../images/favicon.ico" type="image/x-icon">
		<link rel="Bookmark" href="../images/favicon.ico" type="image/x-icon">
		<link rel="stylesheet" href="../css/css.css">
		<link rel="stylesheet" href="../css/sms.css">
		<link rel="stylesheet" href="../css/login.css">
		<link rel="stylesheet" href="../layui/css/layui.css">
		<script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/axios-0.19.2/axios.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
<!--		<script src="../js/js.js"></script>-->
<!--		<script src="../js/sms.js"></script>-->
<!--		<script src="../js/login.js"></script>-->
<!--		<script src="../js/updateip.js"></script>-->
<!--		<script src="../js/push.js"></script>-->

	</head>
	<body style="">
		<div id="loginApp">
			<div class="wrap pd">
				<p id="logo"><a href="javascript:void(0);"><img src="../images/logo.png" alt="心理网"></a></p>
				<p class="title">登录 / 注册</p>
				<p class="fun"><a href="/">&lt; 返回首页</a></p><br class="clear">
			</div>
			<div class="full bg0">
				<div class="wrap pd">
					<div id="login-l">
						<p></p>
					</div>
					<div class="boxs">
						<p id="logoicon"><b>登录&nbsp;/&nbsp;注册</b></p>
						</ul>
						<ul class="loginform" id="loginform_1" style="display: block;">
							<label>名称:</label><li class="in"><input type="text" name="user_name" id="reg_user_name" maxlength="11" placeholder="输入名称"  @input="activeBtn()"></li>
							<label>账号:</label><li class="in"><input type="text" name="login_name" id="reg_login_name" maxlength="11" placeholder="输入账号" @input="activeBtn()"></li>
							<label>密码:</label><li class="in"><input type="password" name="password" id="reg_password" maxlength="6" placeholder="输入密码" @input="activeBtn()"></li>
							<li class="btn">
								<div id="dynsendverify" class="nc-container"></div>
							</li>
							<li class="btn"><input type="button" id="btn_login_1" style="cursor: pointer;" name="btn_login_1" value="注册" class="off" @click="registor(this)"
								 disabled=""></li>
						</ul>
						<ul class="loginform" id="loginform_2" style="display: none;">
							<label>账号:</label><li class="in"><input type="text" name="mobile_2" id="mobile_2" maxlength="50" placeholder="输入账号" value="" @input="activeBtn2()"></li>
							<label>密码:</label><li class="in"><input type="password" name="password_2" id="password_2" maxlength="20" placeholder="输入登录密码" @input="activeBtn2()"
								 onpaste="return false;" oncopy="return false;" oncut="return false;" context="noContext;"><br class="clear"></li>
							<li class="btn"><input type="button" id="btn_login_2" name="btn_login_2" style="cursor: pointer;" value="登录" class="off" @click="login()"></li>
						</ul>
						<ul id="logintype">

							<li class="loginbtn_1" id = "loginbtn_1" style="display: none;"><a href="javascript:void(0);" @click="logintypebtn(1)">用户注册</a></li>
							<li class="loginbtn_2" id = "loginbtn_2" style="display: list-item;"><a href="javascript:void(0);" @click="logintypebtn(2)">账号密码登录</a></li>
						</ul>
					</div>
					<input type="hidden" name="reurl" id="reurl" value="https://www.psy525.cn/index.html">
					<br class="clear">
				</div>
			</div>
			<div class="pagefoot footbd"><br>
				<div class="wrap">
					<ul>
						<li style="text-align:center;line-height:1.8em;font-size:1.1em;margin-bottom:1em;color:#737373"><b>— 心理网郑重提醒 —</b><br>私下交易有风险，付费咨询请使用“预约咨询”，平台担保，支持退款安全有保障！<br><br></li>
					</ul><br class="clear">
				</div>
			</div>
		</div>
		<script>
			var _hmt = _hmt || [];
			(function() {
				var layer = null
				var form = null;
				layui.use(['layer', 'form'], function () {
					layer = layui.layer;
					form = layui.form;
				});
				var hm = document.createElement("script");
				hm.src = "//hm.baidu.com/hm.js?b3ea7cb5fe6857009cefe3f31cc7329a";
				var s = document.getElementsByTagName("script")[0];
				s.parentNode.insertBefore(hm, s);
				var bp = document.createElement('script');
				var curProtocol = window.location.protocol.split(':')[0];
				if (curProtocol === 'https') {
					bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
				} else {
					bp.src = 'http://push.zhanzhang.baidu.com/push.js';
				}
				var s = document.getElementsByTagName('script')[0];
				s.parentNode.insertBefore(bp, s);
			})();

			var loginApp = new Vue({
				el:'#loginApp',
				data:{

				},
				methods:{
					registor:function(obj){
						var userName = $('#reg_user_name').val();
						var loginName = $('#reg_login_name').val();
						var password = $('#reg_password').val();
						let param = new URLSearchParams();
						param.append('userName', userName);
						param.append('loginName', loginName);
						param.append('password', password);
						var that = this;
						axios({
							method: 'post',
							data:param,
							url: '/login/registre.json'
						}).then(function(res) {
							var resultData = res.data;
							if(!resultData.success){
								alert(resultData.msg);
							}else{//保存成功后转入登入页面
								layer.msg('注册成功！', {
									time: 2000 //2秒关闭
								}, function(){
									that.logintypebtn(2);
								});
							}
						})
					},
					login:function(){
						var loginName = $('#mobile_2').val();
						var password = $('#password_2').val();
						let param = new URLSearchParams();
						param.append('loginName', loginName);
						param.append('password', password);
						axios({
							method: 'post',
							data:param,
							url: '/login/login.json'
						}).then(function(res) {
							var resultData = res.data;
							if(!resultData.success){
								alert(resultData.msg);
							}else{//保存成功后转入登入页面
								layer.msg('登入成功！', {
									time: 2000 //2秒关闭
								}, function(){
									//this.logintypebtn(2);
									window.location.href = "/";
								});
							}
						})
					},
					logintypebtn:function(type){
						if(type==1){
							$('#loginform_2').css("display","none");
							$('#loginform_1').css("display","block");
							$('#loginbtn_1').css("display","none");
							$('#loginbtn_2').css("display","list-item");
						}else{
							$('#loginform_1').css("display","none");
							$('#loginform_2').css("display","block");
							$('#loginbtn_2').css("display","none");
							$('#loginbtn_1').css("display","list-item");
						}
					},
					activeBtn:function () {
						var userName = $.trim($('#reg_user_name').val());
						var loginName = $.trim($('#reg_login_name').val());
						var password = $.trim($('#reg_password').val());
						if(userName && loginName && password){
							$('#btn_login_1').attr('disabled',false);
							$('#btn_login_1').removeClass('off');
						}else{
							$('#btn_login_1').attr('disabled',true);
							$('#btn_login_1').addClass('off');
						}
					},
					activeBtn2:function(){
						var loginName = $('#mobile_2').val();
						var password = $('#password_2').val();
						if(loginName && password){
							$('#btn_login_2').attr('disabled',false);
							$('#btn_login_2').removeClass('off');
						}else{
							$('#btn_login_2').attr('disabled',true);
							$('#btn_login_2').addClass('off');
						}
					}

				}
			})
		</script>
		<div class="backToTop" style=""><a href="javascript:void(0);" class="bg"></a></div>
	</body>
</html>
